<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>map</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <script src="dist/echarts.js"></script>
    <script src="map/js/china.js"></script>
    <style>
        *{margin:0;padding:0}
        html,body{
            width:100%;
            height:100%;
        }
        #main{
              width:800px;
              height:600px;
              margin: 150px auto;
              border:1px solid #ddd;
          }
        /*默认长宽比0.75*/
    </style>
</head>
<body>
 <h1 align="center" style="margin-top: 50px">全国业务分布地图</h1>
    <div id="main" style="margin-top: 50px">

    </div>

    <script type="text/javascript">
        function getData() {
            $.post("../statistics/selectByProvinceList",//访问地址
                    {"provinceList":provinceList},//携带参数
                    function (data) {
                       alert(1);
                    }

            ),"json"
        }
        /*传到后端的省份数据*/
        var provinceList = ["南海诸岛","北京市","天津市","上海市","重庆市","河北省",
                         "河南省","云南省","辽宁省","黑龙江省","湖南省","安徽省","山东省","新疆省",
                          "江苏省","浙江省","江西省","湖北省","广西省","甘肃省","陕西省","内蒙古自治区","陕西省","吉林省",
                          "福建省","贵州省","广东省","青海省","西藏自治区","四川省","宁夏自治区","海南省","台湾省","香港","澳门"];

        var dataList=[
            {name:"南海诸岛",value:0},
            {name: '北京', value: 5},
            {name: '天津', value:2},
            {name: '上海', value: 9},
            {name: '重庆', value: 3},
            {name: '河北', value: 15},
            {name: '河南', value: 16},
            {name: '云南', value: 2},
            {name: '辽宁', value: 1},
            {name: '黑龙江', value: 1},
            {name: '湖南', value: 5},
            {name: '安徽', value: 3},
            {name: '山东', value: 7},
            {name: '新疆', value: 0},
            {name: '江苏', value: 9},
            {name: '浙江', value: 11},
            {name: '江西', value: 3},
            {name: '湖北', value: 1},
            {name: '广西', value: 2},
            {name: '甘肃', value: 1},
            {name: '山西', value: 5},
            {name: '内蒙古', value: 0},
            {name: '陕西', value: 26},
            {name: '吉林', value: 3},
            {name: '福建', value: 13},
            {name: '贵州', value: 9},
            {name: '广东', value: 19},
            {name: '青海', value: 1},
            {name: '西藏', value: 0},
            {name: '四川', value: 2},
            {name: '宁夏', value: 0},
            {name: '海南', value: 9},
            {name: '台湾', value: 0},
            {name: '香港', value: 1},
            {name: '澳门', value: 1}
        ]
        var myChart = echarts.init(document.getElementById('main'));
        function randomValue() {
            return Math.round(Math.random()*10);
        }
        option = {
            tooltip: {
                    formatter:function(params,ticket, callback){
                        return params.seriesName+'<br />'+params.name+'：'+params.value
                    }//数据格式化
                },
            visualMap: {
                min: 0,
                max: 30,
                left: 'left',
                top: 'bottom',
                text: ['高','低'],//取值范围的文字
                inRange: {
                    color: ['#e0ffff', '#006edd']//取值范围的颜色
                },
                show:true//图注
            },
            geo: {
                map: 'china',
                roam: false,//不开启缩放和平移
                zoom:1.23,//视角缩放比例
                label: {
                    normal: {
                        show: true,
                        fontSize:'10',
                        color: 'rgba(0,0,0,0.7)'
                    }
                },
                itemStyle: {
                    normal:{
                        borderColor: 'rgba(0, 0, 0, 0.2)'
                    },
                    emphasis:{
                        areaColor: '#F3B329',//鼠标选择区域颜色
                        shadowOffsetX: 0,
                        shadowOffsetY: 0,
                        shadowBlur: 20,
                        borderWidth: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            },
            series : [
                {
                    name: '信息量',
                    type: 'map',
                    geoIndex: 0,
                    data:dataList
                }
            ]
        };
        myChart.setOption(option);
        myChart.on('click', function (params) {
            alert(params.name);
        });

      /*  setTimeout(function () {
            myChart.setOption({
                series : [
                    {
                        name: '信息量',
                        type: 'map',
                        geoIndex: 0,
                        data:dataList
                    }
                ]
            });
        },1000)*/
    </script>
</body>
</html>